package com.songlanyun.modules.account.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.modules.account.entity.UserIdentityAssetEntity;
import com.songlanyun.modules.account.model.dto.PointGiveAwayDTO;
import com.songlanyun.modules.account.model.dto.SetUpPaymentPasswordDTO;
import com.songlanyun.modules.account.model.vo.PointGiveAwayComputerVO;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 会员的资产表（记录余额，一级分拥所得，二级分拥所得等）
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-03 10:01:15
 */
public interface UserIdentityAssetService extends IService<UserIdentityAssetEntity> {

    PageUtils queryPage(Map<String, Object> params);

    int updateUserBalance(UserIdentityAssetEntity userIdentity);


    /**
     * 修改账户余额
     *
     * @param userId 用户id
     * @param money  金额
     * @param isAdd  true:收入 fasle:支出
     */
    UserIdentityAssetEntity updateBalance(Long userId, BigDecimal money, boolean isAdd);

    void checkMoney(Long userId, BigDecimal money);

    /**
     * 修改会员分佣所得
     *
     * @param userId
     * @param money
     * @param isAdd
     * @return
     */
    UserIdentityAssetEntity updateCommissionAble(Long userId, BigDecimal money, boolean isAdd);

    BigDecimal getCommissionAble(Long userId);

    UserIdentityAssetEntity getById(Long userId, boolean isThrow);


    /**
     * 修改账户积分
     *
     * @param userId 用户id
     * @param value  积分
     * @param isAdd  true:收入 fasle:支出
     */
    UserIdentityAssetEntity updateIntegral(Long userId, BigDecimal value, boolean isAdd);

    UserIdentityAssetEntity loadByIdForLock(Long userId, boolean tw);


    /**
     * 更新爱心值
     *
     * @param userId 用户id
     * @param value  积分
     * @param isAdd  true:收入 fasle:支出
     */
    UserIdentityAssetEntity updateLoveValue(Long userId, Integer value, boolean isAdd);

    void setUpPaymentPassword(SetUpPaymentPasswordDTO dto);

    BigDecimal countAllActivationUseCommissionAble();

    void pointGiveAway(Long userId, PointGiveAwayDTO dto);

    PointGiveAwayComputerVO pointGiveAwayComputer(Long userId, PointGiveAwayDTO dto);

    UserIdentityAssetEntity updateVoucher(Long userId, BigDecimal money, boolean isAdd);
}

